package com.baturu.vin.honda.dal.dao;

import com.baturu.vin.dto.EPCPartsDTO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @Author: jiangxinlei
 * @Time: 2019-04-17 14:30
 **/
public interface DataSupportDAO {
    @Update("truncate tmp_data_support")
    void truncateTmp();
    @Select({"select distinct npartgenu from honda_parts_info"})
    List<String> queryAllPartsCode();


    @Insert({"<script>insert ignore into tmp_data_support(vinCode, brand, btrPartsName, partsCode) values",
            "<foreach item='item' collection='parts' index='index' open='' separator=',' close='' >",
            "(#{vinCode},#{brand},#{item.btrPartsName},#{item.partsCode})",
            "</foreach>",
            "</script>"})
    void addSupportData(@Param("vinCode") String vinCode,
                        @Param("brand") String brand,
                        @Param("parts") List<EPCPartsDTO> epcPartsDTOS);

}
